package com.zzs.gmshop.manager.impl;

import com.zzs.gmshop.entity.Book;
import com.zzs.gmshop.manager.AbstractManager;
import com.zzs.gmshop.manager.BookManager;
import com.zzs.gmshop.utils.PagerModel;

public class BookManagerImpl extends AbstractManager implements BookManager {

	public void addBook(Book book) {

		getHibernateTemplate().save(book);
	}

	public void delBook(String id) {

		getHibernateTemplate().delete(findBook(id));
	}

	public PagerModel findAllBook() {
		return searchPaginate("select b from Book b");
	}

	public Book findBook(String id) {

		return (Book)getHibernateTemplate().get(Book.class, id);
	}

	public void updateBook(Book book) {

		getHibernateTemplate().update(book);
	}

}
